package com.example.hqpatrol.broad;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.example.hqpatrol.MainActivity;

import cn.hutool.core.util.StrUtil;

public class MyBroadcastReceiver extends BroadcastReceiver {

    public static final String PATROL_LIST_REMOVE = "patrolListRemove";

    @Override
    public void onReceive(Context context, Intent intent) {
        if(intent == null){
            Log.d("dong", "广播接受器收到的意图是空的");
            return;
        }

        String type = intent.getStringExtra("type");

        // 通知巡检列表移除某一项
        if(StrUtil.equals(PATROL_LIST_REMOVE, type)){
            MainActivity.patrolReadyFragment.removeItem(intent);
        }
    }

}
